package light.head.controller.oa;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import light.head.constant.Parm;
import light.head.constant.Url;
import light.head.dao.sys.FileDAO;
import light.head.enm.RESULT;
import light.head.framework.base.SupporterController;
import light.head.framework.entity.PageBean;

@Controller
@RequestMapping(value = Url.C_ATTENDANCE)
public class AttendanceCotroller extends SupporterController{
	
	public FileDAO fileDAO;
	
	@RequestMapping(value = Url.INIT)
	public ModelAndView init(HttpServletRequest request, HttpServletResponse response) throws Exception {
		return new ModelAndView(Url.ATTENDANCE_INIT);
	}
	
	@RequestMapping(Url.QUERY)
	public ModelAndView query(HttpServletRequest request, HttpServletResponse response) {
		PageBean pb = createPageBean(request);
		Map<String, String> map = createQueryMapByParmName(request, Parm.ATTENDANCE);
		map.put(Parm.ATTENDANCE, Parm.ATTENDANCE);
		if (RESULT.SUCCESS == fileDAO.findByMap(cu_organCode(request), map, pb)) {
			request.setAttribute(Parm.PAGE_BEAN, pb);
		}
		return new ModelAndView(Url.ATTENDANCE_LIST);
	}
	
}
